#!/usr/bin/python3
# coding: utf-8
# authon: ren
from rest_framework import serializers, viewsets

from mainapp.models import User, Store

# 定义模型序列化类
class UserSerializer(serializers.ModelSerializer):

    class Meta:
        model = User
        fields = '__all__'
class StoreSerializer(serializers.ModelSerializer):
    class Meta:
        model = Store
        fields = '__all__'
# 定义视图集
class UserViewset(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer

class StoreViewset(viewsets.ModelViewSet):
    queryset = Store.objects.all()
    serializer_class = StoreSerializer